@echo off
echo 🚀 UEStudio Universal Build Script for Windows

set UESTUDIO_SRC=D:\vc\UEStudio\src
set WXWIN=D:\vc\wxWidgets-3.2.7
set BUILD_TYPE=%~1
if "%BUILD_TYPE%"=="" set BUILD_TYPE=Release
set ARCH=%~2  
if "%ARCH%"=="" set ARCH=x64

echo Build Type: %BUILD_TYPE%
echo Architecture: %ARCH%

:: 设置编译器路径
if "%ARCH%"=="x64" (
    set CC=gcc
    set CXX=g++
) else if "%ARCH%"=="x86" (
    set CC=gcc
    set CXX=g++
) else (
    echo Error: Unknown architecture %ARCH%
    exit /b 1
)

:: 创建构建目录
set BUILD_DIR=build_%ARCH%_%BUILD_TYPE%
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd "%BUILD_DIR%"

:: 配置和编译
echo Configuring UEStudio...
"%UESTUDIO_SRC%/configure" --with-wx-config="%WXWIN%/wx-config" --enable-unicode --with-wx-shared

echo Building UEStudio...
make -j%NUMBER_OF_PROCESSORS%

echo ✅ UEStudio %BUILD_TYPE% build for %ARCH% completed!
pause
